/**************************************************************************
 * @doc STATISTICS
 * @module STATS.H - Header code for the terminal statistics module.|
 * Header code for the American Express handling functions.
 *
 * Product     :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   SoftPay Development Team (I_SP2000).
 * <nl>Notes       :
 *
 * @head3 STATS Functions |
 * @index | STATS
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 *
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form
 * or by any means whether electronic, mechanical, magnetic, optical,
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
 * $log: /Base-99996/Accum/amex.h $
 * ------------------------------------------------------------------------
 ********************************************************************************/

#ifndef _STATS_H_
#define _STATS_H_

typedef struct _stats {
	char chDay;
	int inRebootCount;
	int inTransCount;
	int inCardReadErrors;
	int inPrinterErrors;
	int inPinPadErrors;
	int inNoLine;
	int inBusy;
} STATS;

#define STATS_SIZE	sizeof( STATS )

typedef struct _stats_report {
	char szHeaderLine[32];
	char szDay[10];
	int inReboots;
	int inTransactions;
	int inCardErrs;
	int inPrnErrs;
	int inPinErrs;
	int inNoLine;
	int inBusy;
} STATS_REPORT;

extern STATS gsrStats;
extern STATS_REPORT gsrStatsRpt;

int inIncrementStat( int *pinMember );
int inRollOverStats( STATS *psrStats );
int inStatReportOperation( void );
int STATS_CODE_CHECK(char * a,char *b,short *  c,char * d,unsigned char * e);
int inOpenStatsHistory( int *inFHandle, STATS *psrStats );
int inSaveStatsHistory( int *inFHandle, STATS *psrStats );

#ifdef STATS_DEFINED
#define INCREMENT_REBOOT_COUNT		inIncrementStat( &(gsrStats.inRebootCount) )
#define INCREMENT_TRANS_COUNT		if(!fGetDemoMode()) inIncrementStat( &(gsrStats.inTransCount) )
#define INCREMENT_CARD_ERROR		inIncrementStat( &(gsrStats.inCardReadErrors) )
#define INCREMENT_PRINTER_ERROR		if(fGetEnablePrinter()) inIncrementStat( &(gsrStats.inPrinterErrors) )
#define INCREMENT_PINPAD_ERROR		inIncrementStat( &(gsrStats.inPinPadErrors) )
#define INCREMENT_NOLINE			inIncrementStat( &(gsrStats.inNoLine) )
#define INCREMENT_BUSY				inIncrementStat( &(gsrStats.inBusy) )
#else
#define INCREMENT_REBOOT_COUNT
#define INCREMENT_TRANS_COUNT
#define INCREMENT_CARD_ERROR
#define INCREMENT_PRINTER_ERROR
#define INCREMENT_PINPAD_ERROR
#define INCREMENT_NOLINE
#define INCREMENT_BUSY

#endif //STATS_DEFINED
#endif //_STATS_H_
